<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
  <style rel="stylesheet">
      .layui-unselect {
          height: 30px;
      }
  </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-text-item" style="text-align: center;"><b><!--{$lang.page.public.user}--></b></div>
     <div class="layui-card">
      <div class="layui-form layuiadmin-card-header-auto">
        <div class="layui-text-item">
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.account}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.username}-->
            </div>
          </div>
          <div class="ayui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.realname}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.realname}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.phone}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.mobile}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.public.email}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.email}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.money}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.cash}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.balance}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.amount}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.tradeing}--> <!--{$lang.page.table.balance}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.giftamount}-->
            </div>
          </div>
        </div>
      </div>
     </div>
    </div>
    <div class="layui-card">
              <div class="layui-tab layui-tab-brief layadmin-latestData">
                <ul class="layui-tab-title">
                  <li <!--{if empty($action) || $action=='recharge'}-->class="layui-this"<!--{/if}-->><!--{$lang.page.table.cashin}--></li>
                  <li <!--{if $action=='withdraw'}-->class="layui-this"<!--{/if}-->><!--{$lang.page.table.withdrawal}--></li>
                </ul>
                <div class="layui-tab-content">

                  <div <!--{if empty($action) || $action=='recharge'}-->class="layui-tab-item layui-show"<!--{else}-->class="layui-tab-item"<!--{/if}-->>
                    <table id="recharge" lay-filter="recharge"></table>
                    <script type="text/html" id="rechargetop">

                            <button class="layui-btn layui-btn-sm" lay-event="rerecharge"><!--{$lang.page.public.refresh}--></button>
                            <button class="layui-btn layui-btn-sm" id="rall" lay-event="all"><!--{$lang.page.table.all}--></button>
                            <button class="layui-btn layui-btn-sm" id="rday" lay-event="day"><!--{$lang.page.table.today}--></button>
                            <button class="layui-btn layui-btn-sm" id="rweek" lay-event="week"><!--{$lang.page.table.toweek}--></button>
                            <button class="layui-btn layui-btn-sm" id="rmonth" lay-event="month"><!--{$lang.page.table.tomonth}--></button>
                            <div class="layui-inline layui-btn-sm">
                                <select name="method" id="method" class="layui-unselect" lay-filter="brickType">
                                    <option value="0"><!--{$lang.page.public.select}--></option>
                                    <option value="1"><!--{$lang.page.table.online}--></option>
                                    <option value="2"><!--{$lang.page.table.noauto}--></option>
                                </select>
                            </div>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="currency"></div>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="moneysum"></div>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="integra"></div>   
                    </script>
                  </div>

                  <div <!--{if $action=='withdraw'}-->class="layui-tab-item layui-show"<!--{else}-->class="layui-tab-item"<!--{/if}-->>
                    <script type="text/html" id="zizeng">{{d.LAY_TABLE_INDEX+1}}</script>
                    <table id="withdrawlist"  lay-filter="withdrawlist"></table>
                    <script type="text/html" id="withdrawtop">
                        <div class="layui-btn-container">
                            <button class="layui-btn layui-btn-sm" lay-event="rewithdraw"><!--{$lang.page.public.refresh}--></button>
                            <button class="layui-btn layui-btn-sm" id="all" lay-event="all"><!--{$lang.page.table.all}--></button>
                            <button class="layui-btn layui-btn-sm" id="day" lay-event="day"><!--{$lang.page.table.today}--></button>
                            <button class="layui-btn layui-btn-sm" id="week" lay-event="week"><!--{$lang.page.table.toweek}--></button>
                            <button class="layui-btn layui-btn-sm" id="month" lay-event="month"><!--{$lang.page.table.tomonth}--></button>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="dcurrency"></div>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="dmoney"></div>
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="dintegra"></div> 
                            <div class="layui-btn layui-btn-green layui-btn-sm" id="dfee"></div>
                        </div>
                    </script>
                  </div>

                </div>
              </div>
    </div>

<script src="/static/lay/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
       base: '/static/lay/' //静态资源所在路径
    }).extend({
         roleper:'lib/roleper'
         , xadmin:'lib/xadmin'
         , lang:'lib/lang'
       }).use(['roleper', 'xadmin', 'table', 'lang'], function () {

            var $ = layui.$
            , form = layui.form
            , table = layui.table
            , roleper = layui.roleper
            , toolbar = roleper.showtool({mid:27}) ? false : true; //根据权限是否显示操作列
            var lang=layui.lang.init();
            table.render({
            elem: '#withdrawlist'
            , height: 'auto'
            , url: 'withdraw' //数据接口
            , method: 'post'
            , where: {"id":<!--{$datainfo.aid}-->}
            , page: true //开启分页
            , limit: 10
            , toolbar: '#withdrawtop'
            , defaultToolbar: ['filter', 'exports', 'print']
            , cols: [[ //表头
                {field: 'zizeng', title: function(){ return lang.serial }, align: "center", fixwidth: true, width: 80, templet:'#zizeng'},
                {field: 'username', title: function(){ return lang.account }},
                {field: 'realname', title: function(){ return lang.realname }},
                {field: 'currency', title: function(){ return lang.cashout+lang.curtype}},
                {field: 'money', title: function(){ return lang.cashout+lang.money }},
                {field: 'integra', title: function(){ return lang.cashout+lang.give+lang.money }},
                {field: 'codes', title: function(){ return lang.exchange+lang.curtype}},
                {field: 'remoney', title: function(){ return lang.exchange+lang.cashout+lang.money }},
                {field: 'reintegra', title: function(){ return lang.exchange+lang.give+lang.money }},
                {field: 'fee', title: function(){ return lang.fee }},
                {field: 'createtime', title: function(){ return lang.createtime }},
                {field: 'status', width: 80, title: function(){ return lang.status},
                 templet: function(d) {
                       if (d.status == 1) {
                            return '<button class="layui-btn layui-btn-danger layui-btn-xs">'+lang.applying+'</button>';
                        } else if(d.status == 2) {
                            return '<button class="layui-btn layui-btn-green layui-btn-xs">'+lang.pass+'</button>';
                        } else if(d.status == 3) {
                            return '<button class="layui-btn layui-btn-primary layui-btn-xs">'+lang.gback+'</button>';
                        } else if(d.status == 4) {
                            return '<button class="layui-btn layui-btn-primary layui-btn-xs">'+lang.finish+'</button>';
                        }
                  }
                },
                // {fixed: '', title: function(){ return lang.operation }, width: 160, align: 'center', toolbar: '#withdrawlistbar', hide:toolbar}
            ]],
            done: function(d) {
                layer.closeAll('loading');
                $('#dmoney').html(lang.cashout+lang.total+"："+d.money); // 更新总计内容
                $('#dintegra').html(lang.give+lang.cashout+lang.total+"："+d.integra); // 更新总计内容
                $('#dcurrency').html(lang.curtype+"："+d.currency); // 更新总计内容
                $('#dfee').html(lang.fee+lang.total+"："+d.fee); // 更新总计内容
                // roleper.render({mid:27,per:[{sys:'pay',method:'open'}],full:false});//law 设置长宽，full是否全屏，par父窗口打开
            }
            });

            table.render({
            elem: '#recharge'
            , height: 'auto'
            , url: 'rechargelist' //数据接口
            , method: 'post'
            , where: {"id":<!--{$datainfo.aid}-->}
            , page: true //开启分页
            , limit: 10
            , toolbar: '#rechargetop'
            , defaultToolbar: ['filter', 'exports', 'print']
            , cols: [[ //表头
                {field: 'zizeng', title: '序号', align: "center", fixwidth: true, width: 80, templet:'#zizeng'},
                {field: 'username', title: '申请账户'},
                {field: 'realname', title: '用户'},
                {field: 'currency', title: function(){ return lang.cashin+lang.curtype}},
                {field: 'money', title: function(){ return lang.cashin+lang.money }},
                {field: 'integra', title: function(){ return lang.give+lang.money }},
                {field: 'codes', title: function(){ return lang.exchange+lang.curtype}},
                {field: 'remoney',  title: function(){ return lang.exchange+lang.money}},
                {field: 'reintegra',  title: function(){ return lang.exchange+lang.give+lang.money}},
                {field: 'rate', title: function(){ return lang.exrate}},
                {field: 'type', title: '類型',
                 templet: function(d) {
                       if (d.type == 1) {
                            return '<button class="layui-btn layui-btn-danger layui-btn-xs">交易充值</button>';
                        } else if(d.type == 2) {
                            return '<button class="layui-btn layui-btn-xs">虛擬充值</button>';
                        } 
                  }
                },
                {field: 'method', title: '方式',
                 templet: function(d) {
                       if (d.method == 1) {
                            return '<button class="layui-btn layui-btn-green layui-btn-xs">线上充值</button>';
                        } else if(d.method == 2) {
                            return '<button class="layui-btn layui-btn-danger layui-btn-xs">手动充值</button>';
                        } 
                  }
                },
                {field: 'createtime', title: '提交时间'},
                {field: 'status', width: 80, title: '状态',
                 templet: function(d) {
                       if (d.status == 1) {
                            return '<button class="layui-btn layui-btn-danger layui-btn-xs">申请中</button>';
                        } else if(d.status == 2) {
                            return '<button class="layui-btn layui-btn-xs">退回</button>';
                        } else if(d.status == 3) {
                            return '<button class="layui-btn layui-btn-green layui-btn-xs">通过</button>';
                        }
                  }
                },
                // {fixed: '', title: '操作', width: 160, align: 'center', toolbar: '#rechargebar', hide:toolbar}
            ]],
            done: function(d) {
                layer.closeAll('loading');
                $('#moneysum').html(lang.cashin+lang.total+"："+d.money); // 入金总计
                $('#integra').html(lang.give+lang.total+"："+d.integra); // 赠送总计
                $('#currency').html(lang.curtype+"："+d.currency); // 赠送总计
                // roleper.render({mid:27,per:[{sys:'recharge',method:'open'},{sys:'redit',method:'open'}],full:false});//law 设置长宽，full是否全屏，par父窗口打开
            }
            });

            form.on('select(brickType)', function(data){
                table.reload('recharge',{
                  where: {'method':data.value,'id':<!--{$datainfo.aid}-->},
                  page: {
                    curr: 1 //重新从第 1 页开始
                  }
                });
                $("#method").val(data.value);
            });

            table.on('toolbar(withdrawlist)', function(obj){
                var element = $(".layui-btn-draw").attr("id");
                switch(obj.event){
                    case 'rewithdraw':
                        //执行重载
                        table.reload('withdrawlist');
                        $('#'+element).addClass('layui-btn-danger layui-btn-draw')
                    break;
                    case 'all':
                        //执行重载
                        table.reload('withdrawlist', {
                            where: {'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $('#all').addClass('layui-btn-danger layui-btn-draw')
                    break;
                    case 'day':
                        //执行重载
                        table.reload('withdrawlist', {
                            where: {'time':1,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $('#day').addClass('layui-btn-danger layui-btn-draw')
                    break;
                    case 'week':
                        //执行重载
                        table.reload('withdrawlist', {
                            where: {'time':2,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $('#week').addClass('layui-btn-danger layui-btn-draw')
                    break;
                    case 'month':
                        //执行重载
                        table.reload('withdrawlist', {
                            where: {'time':3,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $('#month').addClass('layui-btn-danger layui-btn-draw')
                    break;
                };
            });
            table.on('toolbar(recharge)', function(obj){
                var element = $(".layui-btn-rech").attr("id");
                var method = $("#method option:selected").val();
                switch(obj.event){
                    case 'rerecharge':
                        //执行重载
                        table.reload('recharge');
                        $('#'+element).addClass('layui-btn-danger layui-btn-rech')
                    break;
                    case 'all':
                        //执行重载
                        table.reload('recharge', {
                            where: {'method':method,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $("#method").val(method);
                        $('#rall').addClass('layui-btn-danger layui-btn-rech')
                    break;
                    case 'day':
                        //执行重载
                        table.reload('recharge', {
                            where: {'method':method, 'time':1,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $("#method").val(method);
                        $('#rday').addClass('layui-btn-danger layui-btn-rech')
                    break;
                    case 'week':
                        //执行重载
                        table.reload('recharge', {
                            where: {'method':method, 'time':2,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $("#method").val(method);
                        $('#rweek').addClass('layui-btn-danger layui-btn-rech')
                    break;
                    case 'month':
                        //执行重载
                        table.reload('recharge', {
                            where: {'method':method, 'time':3,'id':<!--{$datainfo.aid}-->},
                            page: {
                              curr: 1 //重新从第 1 页开始
                            }
                        });
                        $("#method").val(method);
                        $('#rmonth').addClass('layui-btn-danger layui-btn-rech')
                    break;
                };
            });
            
    });
</script>
</body>
</html>

